<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>zhuanyitaiche</title>
    <style type="text/css">
        html {
            height: 100%;
        }

        body {
            height: 100%;
            margin: 0px;
            padding: 0px;
        }

        #myMap {
            height: 100%;
        }
    </style>
    <script type="text/javascript"
            src="http://api.map.baidu.com/api?v=2.0&ak=D7HIoexz4pcKrtQ662GP8FiGj2qwILrx"></script>
</head>

<body>
<div id="myMap"></div>
</body>
</html>
<script src="js/vue.js"></script>
<script src="js/axios.js"></script>
<script type="text/javascript">
    var myMap = new Vue({
        el: '#myMap',
        data() {
            return {
                longitude: 104.059027,//精度
                dimensionality: 30.670344,//维度
            }
        },
        created() {
            // this.fetchData();
        },
        methods: {
            fetchData() {
                axios.post(`/preferential/findPage.do?page=${this.currentPage}&size=${this.size}`, this.searchMap).then(response => {
                    this.tableData = response.data.rows;
                    this.total = response.data.total;
                });
            }
        },
    });
    let map = new BMap.Map("myMap");								//实例化一个地图对象，参数为标签的id，地图会显示在该标签中
    let point = new BMap.Point(myMap.longitude, myMap.dimensionality);				//设置中心点坐标(经度， 纬度)
    //var marker = newBMap.Marker(point);                             //创建标签
    //map.addOverlay(marker);                                            //将标注添加到地图中
    map.centerAndZoom(point, 18);					    				//初始化地图并且设置地图级别
    map.addControl(new BMap.NavigationControl()); 	    				//平移缩放控件
    map.addControl(new BMap.ScaleControl());      	    				//比例尺
    map.addControl(new BMap.OverviewMapControl({isOpen: true}));		//缩略地图
    map.addControl(new BMap.MapTypeControl());    					//地图类型
    map.addControl(new BMap.CopyrightControl());  					//版权
    //map.setCurrentCity("西安");    									//仅当设置城市信息时，MapTypeControl的切换功能才能可用
    map.enableScrollWheelZoom(true);
</script>